Determining a Decompressor s Output Format

The following example determines the buffer size needed for the data specifying the decompression format using the ICDecompressGetFormatSize5KXW0K macro, allocates a buffer of the appropriate size using the GlobalAllocF12W9. function, and retrieves the decompression format information using the ICDecompressGetFormat15ALS4Y macro.

LPBITMAPINFOHEADER lpbiIn, lpbiOut;

 

// Assume *lpbiIn points to the input (compressed) format.

dwFormatSize = ICDecompressGetFormatSize(hIC, lpbiIn);

h = GlobalAlloc(GHND, dwFormatSize);

lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h);

ICDecompressGetFormat(hIC, lpbiIn, lpbiOut);

 

The following example shows how an application can use the ICDecompressQuery8U1GEV macro to determine if a decompressor can handle the input and output formats.

LPBITMAPINFOHEADER lpbiIn, lpbiOut;

// Assume *lpbiIn & *lpbiOut are initialized to the respective
// formats.

if (ICDecompressQuery(hIC, lpbiIn, lpbiOut) == ICERR_OK)

   

    // Format is supported - use the decompressor.

   

}

 

The following code fragment shows how to get the palette information using the ICDecompressGetPalette1MJEBTJ macro.

ICDecompressGetPalette(hIC, lpbiIn, lpbiOut);

 

// Move up to the palette.

lpPalette = (LPBYTE)lpbiOut + lpbi->biSize;